{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "384bbd5d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pygame 2.3.0 (SDL 2.24.2, Python 3.10.9)\n",
      "Hello from the pygame community. https://www.pygame.org/contribute.html\n"
     ]
    }
   ],
   "source": [
    "import pygame\n",
    "from pygame.locals import *\n",
    "from OpenGL.GL import *\n",
    "from OpenGL.GLU import *\n",
    "import matplotlib.cm\n",
    "from vectors import *\n",
    "from math import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "31992abb",
   "metadata": {},
   "outputs": [],
   "source": [
    "def normal(face):\n",
    "    return(cross(subtract(face[1], face[0]), subtract(face[2], face[0])))\n",
    "\n",
    "blues = matplotlib.colormaps.get_cmap('Blues')\n",
    "\n",
    "def shade(face,color_map=blues,light=(1,2,3)):\n",
    "    return color_map(1 - dot(unit(normal(face)), unit(light)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d7913365",
   "metadata": {},
   "outputs": [],
   "source": [
    "light = (1,2,3)\n",
    "faces = [\n",
    "    [(1,0,0), (0,1,0), (0,0,1)],\n",
    "    [(1,0,0), (0,0,-1), (0,1,0)],\n",
    "    [(1,0,0), (0,0,1), (0,-1,0)],\n",
    "    [(1,0,0), (0,-1,0), (0,0,-1)],\n",
    "    [(-1,0,0), (0,0,1), (0,1,0)],\n",
    "    [(-1,0,0), (0,1,0), (0,0,-1)],\n",
    "    [(-1,0,0), (0,-1,0), (0,0,1)],\n",
    "    [(-1,0,0), (0,0,-1), (0,-1,0)],\n",
    "]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2c75f0d5",
   "metadata": {},
   "outputs": [
    {
     "ename": "",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31mThe Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. View Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
     ]
    }
   ],
   "source": [
    "pygame.init()\n",
    "display = (400,400)\n",
    "window = pygame.display.set_mode(display, DOUBLEBUF|OPENGL)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
